package cn.tedu.controller;

import cn.tedu.pojo.Car;
import cn.tedu.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController  //接受请求做出响应
@RequestMapping("/car2")  //指定url和controller的mapping规则
public class CarController2 {
    //想在Controller调用Service的功能,直接DI就可以了
    @Autowired
    private CarService carService;

    @RequestMapping("/get")
    public Car get(){
        return carService.get();
    }
}
